package com.zbb.comm.controller;

import com.zbb.base.model.Result;
import com.zbb.comm.po.OrderSnapshot;
import com.zbb.comm.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author itcast
 */
@Slf4j
@RestController
@Api(value = "离线消息保存",tags = "离线消息保存接口")
public class MessageController {

    @Autowired
    private MessageService  messageService;
//
//    @ApiOperation("发起求助订单详情查询接口")
//    @PostMapping("/saveMessage")
//    public Result saveMessage(String message){
//        System.out.println(message);
//        return Result.ok();
//    }

    @ApiOperation("通知前端求助订单用户订单已被接收")
    @PostMapping("commUserMessage")
    public Result commUserMessage(@RequestBody OrderSnapshot orderSnapshot){
        messageService.commUserMessage(orderSnapshot);
        return Result.ok();
    }

    @ApiOperation("通知前端求助订单帮助用户确认/或拒绝了订单")
    @PostMapping("commHelpUserMessage")
    public Result commHelpUserMessage(@RequestBody OrderSnapshot orderSnapshot){
        messageService.commHelpUserMessage(orderSnapshot);
        return Result.ok();
    }


}
